package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

@Entity
public class Business {
    private Integer businessId;
    private String businessTheme;
    private Date businessStartTime;
    private Date businessOverTime;
    private String businessName;
    private String businessPlace;
    private String businessState;
    private String businessApplicant;
    private String businessApprover;
    private String businessAppstate;
    private Employee employeeByYgId;

    @Id
    @Column(name = "BUSINESS_ID")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public Integer getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Integer businessId) {
        this.businessId = businessId;
    }

    @Basic
    @Column(name = "Business_Theme")
    public String getBusinessTheme() {
        return businessTheme;
    }

    public void setBusinessTheme(String businessTheme) {
        this.businessTheme = businessTheme;
    }

    @Basic
    @Column(name = "Business_Start_Time")
    public Date getBusinessStartTime() {
        return businessStartTime;
    }

    public void setBusinessStartTime(Date businessStartTime) {
        this.businessStartTime = businessStartTime;
    }

    @Basic
    @Column(name = "Business_Over_Time")
    public Date getBusinessOverTime() {
        return businessOverTime;
    }

    public void setBusinessOverTime(Date businessOverTime) {
        this.businessOverTime = businessOverTime;
    }

    @Basic
    @Column(name = "Business_Name")
    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    @Basic
    @Column(name = "Business_Place")
    public String getBusinessPlace() {
        return businessPlace;
    }

    public void setBusinessPlace(String businessPlace) {
        this.businessPlace = businessPlace;
    }

    @Basic
    @Column(name = "Business_State")
    public String getBusinessState() {
        return businessState;
    }

    public void setBusinessState(String businessState) {
        this.businessState = businessState;
    }

    @Basic
    @Column(name = "Business_Applicant")
    public String getBusinessApplicant() {
        return businessApplicant;
    }

    public void setBusinessApplicant(String businessApplicant) {
        this.businessApplicant = businessApplicant;
    }

    @Basic
    @Column(name = "Business_Approver")
    public String getBusinessApprover() {
        return businessApprover;
    }

    public void setBusinessApprover(String businessApprover) {
        this.businessApprover = businessApprover;
    }


    @Basic
    @Column(name = "Business_Appstate")
    public String getBusinessAppstate() {
        return businessAppstate;
    }

    public void setBusinessAppstate(String businessAppstate) {
        this.businessAppstate = businessAppstate;
    }

    @ManyToOne()
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployeeByYgId() {
        return employeeByYgId;
    }

    public void setEmployeeByYgId(Employee employeeByYgId) {
        this.employeeByYgId = employeeByYgId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Business business = (Business) o;
        return businessId == business.businessId &&
                Objects.equals(businessTheme, business.businessTheme) &&
                Objects.equals(businessStartTime, business.businessStartTime) &&
                Objects.equals(businessOverTime, business.businessOverTime) &&
                Objects.equals(businessName, business.businessName) &&
                Objects.equals(businessPlace, business.businessPlace) &&
                Objects.equals(businessState, business.businessState) &&
                Objects.equals(businessApplicant, business.businessApplicant) &&
                Objects.equals(businessApprover, business.businessApprover);
    }

    @Override
    public int hashCode() {
        return Objects.hash(businessId, businessTheme, businessStartTime, businessOverTime, businessName, businessPlace, businessState, businessApplicant, businessApprover);
    }
}
